# -*- coding:utf-8 -*-

from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import gettext_lazy as _


@python_2_unicode_compatible
class TMobilePick(models.Model):
    STATUS = ((0, '提取成功'), (1, '添加成功'),)
    TEST = (
        ('T1', (
            ('1', 'PLEASE...'),
            ('A', 'A'),
            ('B', 'B'),
        )),
        ('T2', (
            ('a1', 'please...'),
            ('a2', 'a'),
            ('a3', 'b'),
        )),
    )
    TEST = ()

    mobile = models.CharField(max_length=20, blank=False, null=False, default='', verbose_name='手机号'
                              , unique=True)
    note = models.CharField(max_length=45, blank=True, null=False, default='', verbose_name='注释')
    create_user = models.CharField(max_length=150, blank=False, null=False, default='', verbose_name='创建人'
                                   , editable=False)
    client_ip = models.CharField(max_length=20, blank=False, null=False, default='', verbose_name='IP'
                                 , editable=False)
    ctime = models.DateTimeField('创建时间', auto_now_add=True, editable=False)
    mtime = models.DateTimeField('修改时间', auto_now=True, editable=False)
    status = models.IntegerField(blank=False, null=False, default=0, verbose_name='状态', choices=STATUS)
    status_text = models.CharField(max_length=90, blank=True, null=False, default='', verbose_name='状态描述')
    wechat = models.CharField(max_length=45, blank=True, null=False, default='', verbose_name='微信归属', choices=(('', '----'),))

    class Meta:
        managed = False
        db_table = 't_mobile_pick'
        verbose_name = _('3.0 管理号码')
        verbose_name_plural = _('3.0.管理号码')

    def __str__(self):
        return self.mobile


class TWechatUser(models.Model):
    ENABLED = 0
    UNABLED = 1
    STATUS = ((ENABLED, '启用'), (UNABLED, '禁用'),)

    username = models.CharField(max_length=45, blank=False, null=False, default='', verbose_name='微信号'
                                , unique=True)
    nickname = models.CharField(max_length=45, blank=False, null=False, default='', verbose_name='昵称')
    note = models.CharField(max_length=90, blank=True, null=False, default='', verbose_name='注释')
    status = models.IntegerField(blank=False, null=False, default=ENABLED, verbose_name='状态', choices=STATUS)
    create_user = models.CharField(max_length=150, blank=False, null=False, default='', verbose_name='创建人'
                                   , editable=False)
    ctime = models.DateTimeField('创建时间', auto_now_add=True, editable=False)
    client_ip = models.CharField(max_length=20, blank=False, null=False, default='', verbose_name='IP'
                                 , editable=False)

    class Meta:
        managed = False
        db_table = 't_wechat_user'
        verbose_name = '2.0 微信帐号'
        verbose_name_plural = '2.0 微信帐号'

    def __str__(self):
        return self.username
